ADF.editpart.DiagramEditPart = function(){
  ADF.editpart.DiagramEditPart.superclass.constructor.call(this);
}

COM.util.defineClass(ADF.editpart.DiagramEditPart, AGEF.AbrazosUnlimitedFreeformEditPart,{
    activate: function(){
        ADF.editpart.DiagramEditPart.superclass.activate.call(this);
        this.getModel().addPropertyChangeListener(this);
    },

    deactivate: function(){
        ADF.editpart.DiagramEditPart.superclass.deactivate.call(this);
        this.getModel().removePropertyChangeListener(this);
    },

    createFigure: function(){
        var diagramFigure = new ADF.figure.DiagramFigure();
        return diagramFigure;
    },

    createEditPolicies: function(){
        ADF.editpart.DiagramEditPart.superclass.createEditPolicies.call(this);
        this.installEditPolicy(COM.gef.EditPolicy.CONTAINER_ROLE, new ADF.policy.DiagramContainerEditPolicy());
        this.installEditPolicy(COM.gef.EditPolicy.LAYOUT_ROLE, new ADF.policy.DiagramXYLayoutPolicy());
        this.installEditPolicy(COM.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new ADF.policy.SnapPolicy());
        this.installEditPolicy(COM.gef.EditPolicy.COMPONENT_ROLE, new AGEF.ComponentEditPolicy());
    },

    getModelChildren: function(){
        var diagram = this.getModel();
        return diagram.getChildren();
    },

    propertyChange: function (evt) {
        var prop = evt.getPropertyName();
        if('children' == prop){
          this.refreshChildren();
        }
    }
});
